﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SerialPortHelper
{
    
    public partial class Form1 : Form
    {
        LLSerialPort serialport;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            serialport = new LLSerialPort();
            serialport.OpenSerialPort("COM1");//open the serial port
            serialport.DataUpdated += (s, data) =>
            {//data come event               

            };
        }
        //send data
        private void button1_Click(object sender, EventArgs e)
        {
            byte[] cmd = { 0xAA, 0xBB, 0x01, 0x0D, 0x01 };
            serialport.SendData(cmd);
        }
    }

    
}
